var app = getApp();
var fr2ssidset='';
var fr2pwdset='';
Page({
  data:{
    fr2ssid:'',
    fr2pwd:'',
    
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    
  },
  onReady:function(){
    // 页面渲染完成
    
  },
  onShow:function(){
    // 页面显示
    this.setData({
      fr2ssid:app.globalData.fr2ssid,
      fr2pwd:app.globalData.fr2pwd,
    })
    
  },
  onHide:function(){
    // 页面隐藏
    
  },
  onUnload:function(){
    // 页面关闭
    
  },
  back:function(){
      console.log("back");
      wx.navigateBack({
          delta:1
      });
  },
  confirm:function(){
     wx.request({
            url: 'http://cd.tunnel.litelink.me/v1/smallapp/device/reboot',
            method:'get',
            data:{
                fr2ssidset : fr2ssidset,
                fr2pwdset : fr2pwdset
            },
            header:{
                "Content-Type":"application/json"
            },
            success: function(res) {
                if(res.data == "ok"){
                  wx.showToast({
                    title: '已修改',
                    icon: 'success',
                    duration: 2000
                  }),
                  app.globalData.fr2ssid=fr2ssidset;
                  app.globalData.fr2pwd=fr2pwdset;
                }
            }
    });
    
  },
  fr2ssidset:function(e){
    
      fr2ssidset=e.detail.value;
    
  },
  fr2pwdset:function(e){
    
      fr2pwdset=e.detail.value;
    
  }

})